define(["ueditor.all","angular"],function()
{
	//上传
	UE.registerUI("upload", function(editor)
	{
		var button=new UE.ui.Button
		({
	        name: "上传",
	        title: "上传",
	        cssRules: 'background-position: -726px -77px;',
	        onclick: function()
	        {
	        	var $element=$("<div ng-controller='UeditorUploadController'><button callback='insert' path='/upload/simple' show='true' upload></button></div>");
	        	var module=angular.module("UeditorUploadModule",["directives","filters"]);
				module.controller("UeditorUploadController",["$scope",function($scope)
				{
					$scope.insert=function(path)
					{
						editor.setContent("<img src='"+path+"'></img>",true);
					};
				}]);
				
				angular.bootstrap($element,["UeditorUploadModule"]);
	        }
		});
		
		return button;
	},[8]);
});